index.html.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <HomePageNavigation></HomePageNavigation>
  5. <!-- 广告位 1 -->
  6. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  7. <!-- 面包屑导航 -->
  8. <div class="breadcrumb">
  9. <div class="inner">
  10. <span class="location">当前位置:</span>
  11. <el-breadcrumb :separator-icon="ArrowRight">
  12. <el-breadcrumb-item>
  13. <NuxtLink to="/">首页</NuxtLink>
  14. </el-breadcrumb-item>
  15. <el-breadcrumb-item>
  16. {{ newsDetail.con_title }}
  17. </el-breadcrumb-item>
  18. </el-breadcrumb>
  19. </div>
  20. </div>
  21. <!-- 资讯列表 -->
  22. <div class="newsDetail">
  23. <div class="inner">
  24. <div class="innerDetail">
  25. <div class="headImg"></div>
  26. <div class="innerDetail1">
  27. <div class="leftBottom" v-html="newsDetail.content"></div>
  28. </div>
  29. <div class="footImg"></div>
  30. </div>
  31. <div class="innerLeft">
  32. <ul>
  33. <li>
  34. 导航列表
  35. </li>
  36. <li v-for="(item, index) in bottomMenu" :key="index">
  37. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  38. v-if="item.id == pageId && item.id != 7" class="active">
  39. {{ item.name }}
  40. </NuxtLink>
  41. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  42. v-else-if="item.id != pageId && item.id != 7">
  43. {{ item.name }}
  44. </NuxtLink>
  45. </li>
  46. </ul>
  47. </div>
  48. <div style="clear: both;"></div>
  49. </div>
  50. </div>
  51. <!-- 广告位 2 -->
  52. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  53. <!-- 页面底部 -->
  54. <HomeFoot1></HomeFoot1>
  55. </template>
  56. <script setup>
  57. //1.页面依赖 start ---------------------------------------->
  58. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  59. import { ArrowRight } from '@element-plus/icons-vue'
  60. import { ref, onMounted } from 'vue';
  61. //获得跳转过来的id
  62. const route = useRoute();
  63. //获得当前的完整路径
  64. const fullPath = route.path;
  65. //拆分,取出来中间这一段,然后提取数字部分
  66. const segments = fullPath.split('/');
  67. const targetSegment = segments[2];
  68. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  69. let articleId;
  70. let pageId;
  71. //通过导航路径反向查询导航id
  72. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  73. method: 'GET',
  74. query: {
  75. 'foot_pinyin': targetSegment,
  76. },
  77. });
  78. if(getRouteId.code == 200){
  79. articleId = getRouteId.data.id;
  80. pageId = getRouteId.data.id;
  81. }else{
  82. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  83. console.log("错误位置:通过url路径查询导航池id")
  84. console.log("后端错误反馈:",getRouteId.message)
  85. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  86. }
  87. //1.页面依赖 end ---------------------------------------->
  88. //2.页面数据 start ---------------------------------------->
  89. //广告列表
  90. let adImg1 = ref([]);
  91. let adImg2 = ref([]);
  92. //获取详情
  93. const newsDetail = ref({})
  94. async function getPageData() {
  95. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  96. method: 'GET',
  97. query: {
  98. 'fcat_id': articleId,
  99. 'type': '0'
  100. },
  101. });
  102. console.log('newsDetail.value', mkdata.data);
  103. newsDetail.value = mkdata.data;
  104. console.log('newsDetail.value', newsDetail.value);
  105. }
  106. getPageData();
  107. //获得底部导航
  108. const bottomMenu = ref([]);
  109. async function getPageMenu() {
  110. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  111. method: 'GET',
  112. query: {},
  113. });
  114. bottomMenu.value = mkdata.data;
  115. }
  116. getPageMenu();
  117. //2.页面数据 end ---------------------------------------->
  118. //4.设置seo信息 start---------------------------------------->
  119. //4.1 设置seo信息
  120. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  121. method: 'GET',
  122. query: {},
  123. });
  124. let seoTitle = setData.data.website_head.title;
  125. let seoDescription = setData.data.website_head.description;
  126. let seoKeywords = setData.data.website_head.keywords;
  127. let seoSuffix = setData.data.website_head.suffix;
  128. let seoName = setData.data.website_head.website_name;
  129. useSeoMeta({
  130. title: seoTitle + "_" + seoSuffix,
  131. meta: [
  132. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  133. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  134. ]
  135. });
  136. //4.设置seo信息 end---------------------------------------->
  137. onMounted(async () => {
  138. //从客户端获取行政职能部门 加快打开速度
  139. const { $webUrl, $CwebUrl } = useNuxtApp();
  140. //广告1
  141. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0001`
  142. const responseAd1 = await fetch(url, {
  143. headers: {
  144. 'Content-Type': 'application/json',
  145. 'Userurl': $CwebUrl,
  146. 'Origin': $CwebUrl
  147. }
  148. });
  149. const resultAd1 = await responseAd1.json();
  150. adImg1.value = resultAd1.data[0];
  151. //广告2
  152. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0002`
  153. const responseAd2 = await fetch(url2, {
  154. headers: {
  155. 'Content-Type': 'application/json',
  156. 'Userurl': $CwebUrl,
  157. 'Origin': $CwebUrl
  158. }
  159. });
  160. const resultAd2 = await responseAd2.json();
  161. adImg2.value = resultAd2.data[0];
  162. })
  163. </script>
  164. <style lang="less" scoped>
  165. @import '@/assets/css/about.less';
  166. </style>